import { createMemoryHistory, createRouter, createWebHashHistory } from 'vue-router'
import LoginView from '@/views/LoginView.vue'
import RegisterView from '@/views/RegisterView.vue'
import ForgotPasswordView from '@/views/ForgotPasswordView.vue'
import LayoutView from '@/views/LayoutView.vue'
import ForumView from '@/views/ForumView.vue'
import HerbScienceView from '@/views/HerbScienceView.vue'
import TCMEncyclopediaView from '@/views/TCMEncyclopediaView.vue'
import OldTCMVisitView from '@/views/OldTCMVisitView.vue'
import PersonalCenterView from '@/views/PersonalCenterView.vue'

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        name: 'Login',
        component: LoginView
    },
    {
        path: '/register',
        name: 'Register',
        component: RegisterView
    },
    {
        path: '/forgot-password',
        name: 'ForgotPassword',
        component: ForgotPasswordView
    },
    {
        path: '/layout',
        component: LayoutView,
        children: [
            {
                path: '/forum',
                component: ForumView,
            },
            {
                path: '/herb-science',
                component: HerbScienceView,
            },
            {
                path: '/tcm-encyclopedia',
                component: TCMEncyclopediaView,
            },
            {
                path: '/old-tcm-visit',
                component: OldTCMVisitView,
            },
            {
                path: '/personal-center',
                component: PersonalCenterView,
            },
            {
                path: '/layout',
                redirect: '/forum'
            }
        ],
    },
]

export const router = createRouter({
    history: createWebHashHistory(),
    routes,
})